

<template>

  <div>
     
     <div style="margin: 0.6rem">
       <div>您正在转赠黄金会员，请输入转赠数量</div>
       <input placeholder="1" style="border:0.01rem black solid; height: 1.75rem; width: 6rem; margin-top: 1rem;padding-left: 0.5rem;"></input>
       <div style="color: #746d60;margin-top: 0.4rem">最多转赠500张</div>
     </div>
     <div style="width: 100%; height: 0.05rem; background-color: #746d60; "></div>
     <div style="width: 6.2rem;font-size: 1rem; height: 2.2rem; background-color: #9e0b8a;line-height: 2.2rem;text-align: center;color: white;margin:0 auto; margin-top: 2rem">确认转赠</div>
  
  </div>

</template>

<script>
import { base64} from 'vux'
export default {

  components: {
    base64
  },
  data () {
    return {
     
     access_token:'',
     id:this.$route.params.id,
    
    }
  },
  methods:{
     
    //TODO
    //获取可转赠数量
    getDetail(){
    	
	    this.$store.commit('updateLoadingStatus',true);
	    	
	    this.$http.get(this.$store.state.api + 'index/award-left&access_token=' + this.access_token + '&id=' + this.id)
	    .then((response) => {
	    		
	    console.log(response)
			
			if(response.body.code == 0) {
				
				
				
				console.log(this.list)
				
			} else if(response.body.code == 1){
				
				
			}
			
		    this.$store.commit('updateLoadingStatus',false);
		    
		}, (response) => {
	         
	         
		});
    },
    //获取地址栏信息
		getUrlStr(name){
	      let reg = new RegExp("(^|\\?|&)" + name + "=([^&]*)(\\s|&|$)","i");
	      if(reg.test(window.location.href)){
	        return unescape(RegExp.$2.replace(/\+/g," "))
	      }
	      return undefined
	    },
    
  },
  
  mounted() {
			
		  var access_token = this.getUrlStr('access_token');
           var parentId = this.getUrlStr('parent_id');
           
            if(parentId == undefined){
              parentId = 0;
           }
           
           var uid = this.getUrlStr('uid');
           
           if(parentId.toString().indexOf('?') > 0){
           	 parentId = parentId.split('?')[0];
           }
           
           var locurl = location.href;
           locurl = base64.encode(locurl.split('?')[0]);
           
       
           if(access_token != undefined){
         
              localStorage.setItem("access_token",access_token); 
              localStorage.setItem("parent_id",this.getUrlStr('uid'));


           }
           
            if(localStorage.getItem('access_token') != null){
         
              this.$root.registerjudge();
              this.$root.getShare();
              
            }else{
            	
        	  this.$root.gotoWechat(locurl,parentId);
            }
           
    	   this.access_token = localStorage.getItem('access_token');
		
		
		  this.getDetail();
			
		},


}



</script>


<style lang="less" scoped>
  


</style>
